﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace UnityConfig
{
    [XmlRoot(ElementName = "unity",Namespace = null)]
    public class Unity
    {
        //[XmlElement(ElementName = "typeAliases")]
        [XmlArrayItem(ElementName = "typeAlias")]
        [XmlArray(ElementName = "typeAliases")]
        public List<TypeAlias> TypeAliases { get; set; }

        [XmlArray(ElementName = "containers")]
        [XmlArrayItem(ElementName = "container")]
        public List<Container> Containers { get; set; }
    }

    public class TypeAlias
    {
        [XmlAttribute(AttributeName = "alias")]
        public string Alias { get; set; }

        [XmlAttribute(AttributeName = "type")]
        public string Type { get; set; }
    }

    public class Container
    {
        [XmlArrayItem(ElementName = "type")]
        [XmlArray(ElementName = "types")]
        public List<UnityMapType> Types { get; set; }
    }

    public class UnityMapType
    {
        [XmlAttribute(AttributeName = "type")]
        public string Type { get; set; }

        [XmlAttribute(AttributeName = "mapTo")]
        public string MapTo { get; set; }
    }
}
